<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>8 模板语法-指令</title>
    <script src="js/vue.global.js"></script>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app">
    <p>页面载入时，input 元素自动获取焦点：</p>
    <input v-focus>
</div>

<script>
    const app = {
        data() {
            return {
            }
        },
        directives: {
            focus: {
                // 指令的定义
                mounted(el) {
                    el.focus()
                }
            }
        }
    }

    Vue.createApp(app).mount('#app')
</script>
</body>
</html>